﻿<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Description>用于生成 Rafy 查询条件类整个文件的模板</Description>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
            </SnippetTypes>
            <Title>Rafy Criteria File</Title>
            <Author>HuQingfang</Author>
            <Shortcut>RafyCriteria_File</Shortcut>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>NAMESPACE</ID>
                    <Default>Rafy</Default>
                </Literal>
                <Literal>
                    <ID>CriteraName</ID>
                    <Default>CriteraName</Default>
                </Literal>
            </Declarations>
            <Code Language="csharp">
                <![CDATA[using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Security.Permissions;
using System.Text;
using Rafy.Domain;
using Rafy.MetaModel;
using Rafy.MetaModel.Attributes;
using Rafy.MetaModel.View;

namespace $NAMESPACE$
{
    [QueryEntity, Serializable]
    public class $CriteraName$ : Criteria
    {
        #region 构造函数

        public $CriteraName$() { }

        [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)]
        protected $CriteraName$(SerializationInfo info, StreamingContext context) : base(info, context) { }

        #endregion
        
        public static readonly Property<string> NameProperty = P<$CriteraName$>.Register(e => e.Name);
        public string Name
        {
            get { return this.GetProperty(NameProperty); }
            set { this.SetProperty(NameProperty, value); }
        }$end$
    }

    internal class $CriteraName$Config : EntityConfig<$CriteraName$>
    {
        protected override void ConfigView()
        {
            using (View.OrderProperties())
            {
                View.Property($CriteraName$.NameProperty).HasLabel("名称").ShowIn(ShowInWhere.Detail).FireNavigation();
            }
        }
    }
}]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>